package com.ruoyi.crm.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.MongoLog;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.crm.domain.Clue;
import com.ruoyi.crm.domain.vo.ClueTrackVo;
import com.ruoyi.crm.service.IClueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/crm/clueTrack")
public class ClueTrackController extends BaseController {
    @Autowired
    private IClueService clueService;

    @PreAuthorize("@ss.hasPermi('crm:clue:edit')")
    @MongoLog(tableName = MongoLog.TableName.CLUE,title = "线索跟进记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ClueTrackVo clueTrackVo){
        clueTrackVo.setStatus(Clue.Status.TRACKING.getValue());
        return toAjax(clueService.updateClue(clueTrackVo));
    }



}
